﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Veteran_cms.Models.HomeAdminListViewModel>" %>
<%@ Import Namespace="THS.HtmlHelpers" %>
<div class="widget">
    <div class="title">
        <span class="titleIcon">
            <input type="checkbox" id="titleCheck" name="titleCheck" /></span><h6>
                Danh sách tin tức - thời sự</h6>
        <div style="float: right">
            <a href="<%=Url.Action("Create","ManageEvent") %>" title="" class="button greyishB"
                style="margin: 5px;">
                <img src="../../images/adminSite/icons/light/create.png" alt="" class="icon" /><span>THÊM
                    MỚI</span></a></div>
    </div>
    <table cellpadding="0" cellspacing="0" width="100%" class="sTable withCheck mTable"
        id="checkAll">
        <thead>
            <tr>
                <td>
                    <img src="../../images/adminSite/icons/tableArrows.png" alt="" />
                </td>
                <td style="width: 15%" class="sortCol">
                    <div>
                        Tiêu đề<span></span></div>
                </td>
                <td style="width: 20%" class="sortCol">
                    <div>
                        Sơ lược<span></span>
                    </div>
                </td>
                <td style="width: 15%" class="sortCol">
                    <div>
                        Ngày sự kiện<span></span></div>
                </td>
                <td style="width: 20%" class="sortCol">
                    <div>
                        Địa điểm<span></span></div>
                </td>
                <td style="width: 15%" class="sortCol">
                    <div>
                        Cho phép hiển thị<span></span></div>
                </td>
                <td>
                    Chức năng
                </td>
            </tr>
        </thead>
        <tfoot>
            <tr>
                <td colspan="7">
                    <div class="tPagination">
                        <%if (Model != null)
                          { %>
                        <%=Ajax.Pager(Model.EventPageInfo.CurrentPage, Model.EventPageInfo.TotalItems, "EventList", 0, Model.EventPageInfo.ItemsPerPage, "Paging")%>
                        <%} %>
                    </div>
                </td>
            </tr>
        </tfoot>
        <tbody>
            <%if (Model.Events != null)
              {
                  foreach (var item in Model.Events)
                  {%>
            <tr>
                <td>
                    <input type="checkbox" id="titleCheck2" name="checkRow" />
                </td>
                <td>
                    <a href="<%=Url.Action("Details", "ManageEvent", new {id = item.event_id}) %>" title="">
                        <%=item.title%></a>
                </td>
                <td>
                    <i>
                        <%=item.sub_title%></i>
                </td>
                <td>
                    <i>
                        <%=item.event_date.ToString("dd-MM-yyyy")%></i>
                </td>
                <td>
                    <i>
                        <%=item.location%></i>
                </td>
                <td>
                    <i>
                        <%= Html.CheckBox("visible", item.visible, new { onclick = "AllowVisisble('"+item.event_id+"')" })%></i>
                </td>
                <td class="actBtns">
                    <a href="<%=Url.Action("Details", "ManageEvent", new {id = item.event_id}) %>" title="Cập nhật"
                        class="tipS">
                        <img src="../../images/adminSite/icons/dark/pencil.png" alt="" /></a> <a href="<%=Url.Action("Delete", "ManageEvent", new {id = item.event_id}) %>"
                            title="Xóa" class="tipS">
                            <img src="../../images/adminSite/icons/uploader/deleteFile.png" alt="" onclick="return ConfirmDelete()" /></a>
                </td>
            </tr>
            <%}
              }%>
        </tbody>
    </table>
</div>
<script type="text/javascript">
    function AllowVisisble (id) {
        if (confirm("Bạn chắc chắn thực hiện thao tác này?") == true)
            $.post("/ManageEvent/AllowVisible", { id: id });
        else {
            document.location = "/ManageEvent/IndexEvents";
        }
    }

</script>